package com.me.modules.knowledge.service.impl;

import com.me.modules.common.common.Constant;
import com.me.modules.common.page.Page;
import com.me.modules.common.page.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.me.modules.knowledge.dao.KnowledgeInfoDao;
import com.me.modules.knowledge.entity.KnowledgeInfoEntity;
import com.me.modules.knowledge.service.KnowledgeInfoService;



@Service("knowledgeInfoService")
public class KnowledgeInfoServiceImpl implements KnowledgeInfoService {
	@Autowired
	private KnowledgeInfoDao knowledgeInfoDao;

	@Override
	public KnowledgeInfoEntity queryObject(String id){
		return knowledgeInfoDao.queryObject(id);
	}

	@Override
	public List<KnowledgeInfoEntity> queryList(Map<String, Object> map){
		return knowledgeInfoDao.queryList(map);
	}

	@Override
    public List<KnowledgeInfoEntity> queryListByBean(KnowledgeInfoEntity entity) {
        return knowledgeInfoDao.queryListByBean(entity);
    }

	@Override
	public int queryTotal(Map<String, Object> map){
		return knowledgeInfoDao.queryTotal(map);
	}

	@Override
	public int save(KnowledgeInfoEntity knowledgeInfo){
		return knowledgeInfoDao.save(knowledgeInfo);
	}

	@Override
	public int update(KnowledgeInfoEntity knowledgeInfo){
        return knowledgeInfoDao.update(knowledgeInfo);
	}

	@Override
	public int delete(String id){
        return knowledgeInfoDao.delete(id);
	}

	@Override
	public int deleteBatch(Long[] ids){
        return knowledgeInfoDao.deleteBatch(ids);
	}

	@Override
	public Page<KnowledgeInfoEntity> findPage(KnowledgeInfoEntity knowledgeInfo, int pageNum) {
		PageHelper.startPage(pageNum, Constant.pageSize);
		knowledgeInfoDao.queryList(knowledgeInfo);
		return PageHelper.endPage();
	}

	@Override
	public Page<KnowledgeInfoEntity> searchList(KnowledgeInfoEntity knowledgeInfo, int pageNum) {
		PageHelper.startPage(pageNum, Constant.pageSize);
		knowledgeInfoDao.searchList(knowledgeInfo);
		return PageHelper.endPage();
	}

}
